<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/invoice/invoiceRecordOperator.js"></script>
    <style>
        .layui-card {
            box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .4) !important;
            text-align: center !important;
            border-top: 1px solid rgb(224, 224, 224);
        }
    </style>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>运营管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>开票记录</strong>'
    });

    var has_add = '';
    var has_edit = '';
    var has_delete = '';
</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <div class="row" style="padding-bottom: 15px !important;">
                    <div class="pull-left search col-md-2">
                        <input id="beginTime" name="beginTime" type="text" class="form-control"
                               placeholder="开始时间" readonly>
                        <input id="nickname" name="nickname" type="text" class="form-control"
                               placeholder="开票人">
                    </div>
                    <div class="pull-left search col-md-2">
                        <input id="endTime" name="endTime" type="text" class="form-control" readonly
                               placeholder="结束时间">
                        <input id="addressee" name="addressee" type="text" class="form-control"
                               placeholder="收件人">


                    </div>
                    <div class="pull-left search col-md-2">
                        <select type="text" class="form-control" name="status" id="status">
                            <option value="">审核状态</option>
                            <option value="0">待审核</option>
                            <option value="1">已通过</option>
                            <option value="2">已驳回</option>
                        </select>
                        <input id="addresseeTel" name="addresseeTel" type="text" class="form-control"
                               placeholder="收件人手机">
                    </div>
                    <div class="pull-left search col-md-2">
                        <button class="btn btn-success" onclick="invoiceRecord.reLoad()">查询</button>
                    </div>
                    <div class="pull-left search col-md-2">
                        <button class="btn btn-success exportBtn" onclick="invoiceRecord.selectInvoiceApply()">导出</button>
                    </div>
                </div>
                <div class="row "
                     style="display: flex;justify-content: space-evenly;padding-bottom: 0.1rem;margin-top: 1px !important;">
                    <div class="col-md-2 ">
                        <div class="layui-card">
                            <div class="layui-card-header">开票申请(条)</div>
                            <div class="layui-card-body" id="countInvoiceApply">

                            </div>
                        </div>
                    </div>
                    <div class="col-md-2 ">
                        <div class="layui-card">
                            <div class="layui-card-header">已开票(条)</div>
                            <div class="layui-card-body" id="countInvoiceAgree">

                            </div>
                        </div>
                    </div>
                    <div class="col-md-2 ">
                        <div class="layui-card">
                            <div class="layui-card-header">驳回(条)</div>
                            <div class="layui-card-body" id="countInvoiceOverrule">

                            </div>
                        </div>
                    </div>
                    <div class="col-md-2 ">
                        <div class="layui-card">
                            <div class="layui-card-header">待审核(条)</div>
                            <div class="layui-card-body" id="countInvoicePending">

                            </div>
                        </div>
                    </div>
                </div>
                <table id="exampleTable" data-mobile-responsive="true">
                </table>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function countInvoiceByStation() {
        $.ajax({
            url: prefix + "/countInvoiceByStation",
            type: "GET",
            data: {
                'elecStationId': $("#elecStationId").val(),
            },
            success: function (data) {
                if (data.status == 200) {
                    document.getElementById("countInvoiceApply").innerHTML = data.data.countInvoiceApply;
                    document.getElementById("countInvoiceAgree").innerHTML = data.data.countInvoiceAgree;
                    document.getElementById("countInvoiceOverrule").innerHTML = data.data.countInvoiceOverrule;
                    document.getElementById("countInvoicePending").innerHTML = data.data.countInvoicePending;

                } else {
                    layer.msg(data.message);
                }
            }
        });
    }

    countInvoiceByStation()

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        var beginTime = laydate.render({
            elem: '#beginTime',
            type: 'datetime',
            format: 'yyyy-MM-dd HH:mm:ss',
            trigger: 'click',
            done: function (value, dates) {
                endTime.config.min = {
                    year: dates.year,
                    month: dates.month - 1, //关键
                    date: dates.date,
                    hours: 0,
                    minutes: 0,
                    seconds: 0
                };
            }
        });
        var endTime = laydate.render({
            elem: '#endTime',
            type: 'datetime',
            format: 'yyyy-MM-dd HH:mm:ss',
            trigger: 'click'
        });

    });

    invoiceRecord.init();
</script>
</body>
</html>
